Skip to main content

For Each Folder

AutomatR.DefaultActivities.FileAndFolder.ForEachFolder

The "For Each Folder" activity in AutomatR is designed for iterating through folders within a specified directory, allowing users to perform a series of actions on each folder. This activity is part of the File and Folder activities package, providing flexibility in managing and processing folders within a workflow.

Properties

NameDescription
Input
Filter By NameProvides the option to filter folders based on their names. Specify the folder name to apply the filter. String variables containing the folder name. If not specified, "*" is used as a wildcard for all folders.
In FolderSpecifies the complete path for the folder on which you wish to perform operations. String variables containing the folder path.
Include SubfoldersIndicates whether to expand the search to include all subfolders of the selected location. This field accepts Boolean values. Boolean variables containing the choice to include subfolders or not.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. Enhances clarity and organization within the automation project. String variables containing the desired display name.
VariablesRepresents the index of the current iteration within the "For Each Folder" loop. Integer variables or arguments to store the index value.
Optional
DelaySpecifies the amount of time (in seconds) to wait before executing the "For Each Folder" activity. Useful for handling synchronization issues. Integer variables containing the delay duration. Example: If the wait time is 1000 milliseconds or 1 sec, i.e., 1.

How to use:

  1. Drag and drop the "For Each Folder" activity onto the workflow.
  2. Configure the properties by specifying the folder path, optional filter by name, delay, and whether to include subfolders.
  3. Optionally, customize the display name.
  4. Add activities inside the "For Each Folder" activity to define the actions to be performed on each folder.
  5. Execute the workflow to iterate through folders based on the specified criteria.

Example: Consider an example where the "For Each Folder" activity is used to process folders in a directory:

For Each Folder:
Display Name: "Process Folders"
In Folder: "C:\MyFiles"
Filter By Name: "Project*"
Include Subfolders: true
Result: isProcessingSuccessful

In this example, the activity iterates through folders in the "C:\MyFiles" directory, applying the filter to include only folders starting with "Project." The result of the operation (success or failure) is stored in the Boolean variable "isProcessingSuccessful" for further handling in the workflow.